package com.fjec.market.controller;

import com.fjec.common.enums.EnumSysCode;
import com.fjec.common.protocol.JsonResult;
import com.fjec.common.shiro.AccountInfo;
import com.fjec.market.entity.BizDepositOperateRecord;
import com.fjec.market.service.IBizDepositOperateRecordHistoryService;
import com.fjec.market.service.IBizDepositOperateRecordService;
import com.fjec.market.service.IInfoBusinessService;
import com.fjec.market.service.IInfoFarmerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * 保证金处理业务
 */
@Slf4j
@RestController
@RequestMapping("/")
public class DepositController {

    @Resource
    private IInfoFarmerService infoFarmerService;

    @Resource
    private IInfoBusinessService infoBusinessService;
    /**
     * 获取店铺保证金信息
     *
     * @return
     */
    @GetMapping("/y/shop/deposit/info")
    public JsonResult getDepositInfo() {
        Integer busiType = AccountInfo.getBusiType();
        switch (busiType) {
            case 2:
                // 果农
                return infoFarmerService.getDepositInfo();
            case 3:
            case 4:
            case 5:
                // 分拣厂、农资厂、包装厂
                return infoBusinessService.getDepositInfo();
            default:
                return JsonResult.failure()
                        .code(EnumSysCode.ERR_0002.getCode())
                        .message(EnumSysCode.ERR_0002.getMsg())
                        .build();
        }
    }

}
